//
//  ReuseCtr.m
//  tableViewDemo
//
//  Created by lix on 16/8/25.
//  Copyright © 2016年 lix. All rights reserved.
//

#import "ReuseCtr.h"

@interface ReuseCtr (){
    int count;
}

@end

@implementation ReuseCtr

- (id)init{
    if (self = [super init]) {
        
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"tableView重用";
    self.view.backgroundColor = [UIColor whiteColor];
    count = 0;
    [self initTableVIew];
}

- (void)initTableVIew{
    _tableView = [[UITableView alloc]initWithFrame:FRAME style:UITableViewStylePlain];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    [self.view addSubview:_tableView];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 30;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    count ++;
    static NSString * CellIdentifier = @"cell";
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == NULL) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
        
    }
    cell.textLabel.text = [NSString stringWithFormat:@"%d",count];
    
    return cell;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
